package com.neuedu.yyzx.framework;

public class Res<T> {
    private Integer code;  //200 404 403 500
    private String msg;
    private T data;

    public Res(){

    }
    public Res(Integer code,String msg,T data){
        this.code=code;
        this.msg=msg;
        this.data=data;
    }
    public static Res ok(){
        Res res = new Res();
        res.setCode(200);
        return  res;
    }

    public static Res ok(Object data){
        Res res = ok();
        res.setData(data);
        return  res;
    }

    public static Res failed(Integer code,String msg){
        Res res = new Res(code, msg, null);
        return  res;
    }

    public static Res failed(String msg){
        return  failed(500,msg);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
